<?php
class ProvinceAction extends LoginAction
{
    public function index ()
    {
        $this->ajaxReturn($this->get());
    }
    /**
     * 获取一个地区信息
     * @author Ice iceinto@mallog.com.cn
     */
    public function only ()
    {
        $code = (int) getGetOrPost('code');
        $map = array();
        if ($code) {
            $map['code'] = $code;
        }
        $this->ajaxReturn($this->get($map));
    }
    /**
     * 根据配置获取信息
     * @param Array $map 获取配置
     * @author Ice iceinto@mallog.com.cn
     */
    public function get ($map = array())
    {
        $ProvinceModel = M('Province');
        $data = $ProvinceModel->where($map)
            ->field('code,name')
            ->select();
        return $data;
    }
}
?>